Integrand size = 13, antiderivative size = 26 \[ \int \cos (a+b x) \sec (c+b x) \, dx=x \cos (a-c)+\frac {\log (\cos (c+b x)) \sin (a-c)}{b} \]
Time = 0.15 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.00 \[ \int \cos (a+b x) \sec (c+b x) \, dx=x \cos (a-c)+\frac {\log (\cos (c+b x)) \sin (a-c)}{b} \]
Time = 0.21 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {5094, 24, 3042, 3956}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \cos (a+b x) \sec (b x+c) \, dx\) |
\(\Big \downarrow \) 5094 |
\(\displaystyle \cos (a-c) \int 1dx-\sin (a-c) \int \tan (c+b x)dx\) |
\(\Big \downarrow \) 24 |
\(\displaystyle x \cos (a-c)-\sin (a-c) \int \tan (c+b x)dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle x \cos (a-c)-\sin (a-c) \int \tan (c+b x)dx\) |
\(\Big \downarrow \) 3956 |
\(\displaystyle \frac {\sin (a-c) \log (\cos (b x+c))}{b}+x \cos (a-c)\) |
3.3.41.3.1 Defintions of rubi rules used
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d *x], x]]/d, x] /; FreeQ[{c, d}, x]
Int[Cos[v_]*Sec[w_]^(n_.), x_Symbol] :> Simp[-Sin[v - w] Int[Tan[w]*Sec[w ]^(n - 1), x], x] + Simp[Cos[v - w] Int[Sec[w]^(n - 1), x], x] /; GtQ[n, 0] && FreeQ[v - w, x] && NeQ[w, v]
Result contains complex when optimal does not.
Time = 1.08 (sec) , antiderivative size = 66, normalized size of antiderivative = 2.54
method | result | size |
risch | \(-2 i \sin \left (a -c \right ) x -\frac {2 i \sin \left (a -c \right ) a}{b}+x \,{\mathrm e}^{i \left (a -c \right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (x b +a \right )}+{\mathrm e}^{2 i \left (a -c \right )}\right ) \sin \left (a -c \right )}{b}\) | \(66\) |
default | \(\frac {\frac {\left (\sin \left (a \right ) \cos \left (c \right )-\cos \left (a \right ) \sin \left (c \right )\right ) \ln \left (\tan \left (x b +a \right ) \sin \left (a \right ) \cos \left (c \right )-\tan \left (x b +a \right ) \cos \left (a \right ) \sin \left (c \right )+\cos \left (a \right ) \cos \left (c \right )+\sin \left (a \right ) \sin \left (c \right )\right )}{\cos \left (a \right )^{2} \cos \left (c \right )^{2}+\cos \left (c \right )^{2} \sin \left (a \right )^{2}+\cos \left (a \right )^{2} \sin \left (c \right )^{2}+\sin \left (a \right )^{2} \sin \left (c \right )^{2}}+\frac {\frac {\left (\cos \left (a \right ) \sin \left (c \right )-\sin \left (a \right ) \cos \left (c \right )\right ) \ln \left (1+\tan \left (x b +a \right )^{2}\right )}{2}+\left (\cos \left (a \right ) \cos \left (c \right )+\sin \left (a \right ) \sin \left (c \right )\right ) \arctan \left (\tan \left (x b +a \right )\right )}{\left (\cos \left (c \right )^{2}+\sin \left (c \right )^{2}\right ) \left (\cos \left (a \right )^{2}+\sin \left (a \right )^{2}\right )}}{b}\) | \(161\) |
-2*I*sin(a-c)*x-2*I/b*sin(a-c)*a+x*exp(I*(a-c))+ln(exp(2*I*(b*x+a))+exp(2* I*(a-c)))/b*sin(a-c)
Time = 0.25 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.19 \[ \int \cos (a+b x) \sec (c+b x) \, dx=\frac {b x \cos \left (-a + c\right ) - \log \left (-\cos \left (b x + c\right )\right ) \sin \left (-a + c\right )}{b} \]
Leaf count of result is larger than twice the leaf count of optimal. 182 vs. \(2 (20) = 40\).
Time = 3.52 (sec) , antiderivative size = 435, normalized size of antiderivative = 16.73 \[ \int \cos (a+b x) \sec (c+b x) \, dx=- \left (\begin {cases} - x & \text {for}\: c = \frac {\pi }{2} \\x & \text {for}\: c = - \frac {\pi }{2} \\0 & \text {for}\: b = 0 \\- \frac {2 b x \tan {\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} - \frac {\log {\left (\tan ^{2}{\left (\frac {b x}{2} \right )} + 1 \right )} \tan ^{2}{\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} + \frac {\log {\left (\tan ^{2}{\left (\frac {b x}{2} \right )} + 1 \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} + \frac {\log {\left (\tan {\left (\frac {b x}{2} \right )} - \frac {\tan {\left (\frac {c}{2} \right )}}{\tan {\left (\frac {c}{2} \right )} - 1} - \frac {1}{\tan {\left (\frac {c}{2} \right )} - 1} \right )} \tan ^{2}{\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} - \frac {\log {\left (\tan {\left (\frac {b x}{2} \right )} - \frac {\tan {\left (\frac {c}{2} \right )}}{\tan {\left (\frac {c}{2} \right )} - 1} - \frac {1}{\tan {\left (\frac {c}{2} \right )} - 1} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} + \frac {\log {\left (\tan {\left (\frac {b x}{2} \right )} + \frac {\tan {\left (\frac {c}{2} \right )}}{\tan {\left (\frac {c}{2} \right )} + 1} - \frac {1}{\tan {\left (\frac {c}{2} \right )} + 1} \right )} \tan ^{2}{\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} - \frac {\log {\left (\tan {\left (\frac {b x}{2} \right )} + \frac {\tan {\left (\frac {c}{2} \right )}}{\tan {\left (\frac {c}{2} \right )} + 1} - \frac {1}{\tan {\left (\frac {c}{2} \right )} + 1} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} & \text {otherwise} \end {cases}\right ) \sin {\left (a \right )} + \left (\begin {cases} - \frac {\log {\left (\sin {\left (b x \right )} \right )}}{b} & \text {for}\: c = \frac {\pi }{2} \\\frac {\log {\left (\sin {\left (b x \right )} \right )}}{b} & \text {for}\: c = - \frac {\pi }{2} \\\frac {x}{\cos {\left (c \right )}} & \text {for}\: b = 0 \\- \frac {b x \tan ^{2}{\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} + \frac {b x}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} + \frac {2 \log {\left (\tan ^{2}{\left (\frac {b x}{2} \right )} + 1 \right )} \tan {\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} - \frac {2 \log {\left (\tan {\left (\frac {b x}{2} \right )} - \frac {\tan {\left (\frac {c}{2} \right )}}{\tan {\left (\frac {c}{2} \right )} - 1} - \frac {1}{\tan {\left (\frac {c}{2} \right )} - 1} \right )} \tan {\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} - \frac {2 \log {\left (\tan {\left (\frac {b x}{2} \right )} + \frac {\tan {\left (\frac {c}{2} \right )}}{\tan {\left (\frac {c}{2} \right )} + 1} - \frac {1}{\tan {\left (\frac {c}{2} \right )} + 1} \right )} \tan {\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} & \text {otherwise} \end {cases}\right ) \cos {\left (a \right )} \]
-Piecewise((-x, Eq(c, pi/2)), (x, Eq(c, -pi/2)), (0, Eq(b, 0)), (-2*b*x*ta n(c/2)/(b*tan(c/2)**2 + b) - log(tan(b*x/2)**2 + 1)*tan(c/2)**2/(b*tan(c/2 )**2 + b) + log(tan(b*x/2)**2 + 1)/(b*tan(c/2)**2 + b) + log(tan(b*x/2) - tan(c/2)/(tan(c/2) - 1) - 1/(tan(c/2) - 1))*tan(c/2)**2/(b*tan(c/2)**2 + b ) - log(tan(b*x/2) - tan(c/2)/(tan(c/2) - 1) - 1/(tan(c/2) - 1))/(b*tan(c/ 2)**2 + b) + log(tan(b*x/2) + tan(c/2)/(tan(c/2) + 1) - 1/(tan(c/2) + 1))* tan(c/2)**2/(b*tan(c/2)**2 + b) - log(tan(b*x/2) + tan(c/2)/(tan(c/2) + 1) - 1/(tan(c/2) + 1))/(b*tan(c/2)**2 + b), True))*sin(a) + Piecewise((-log( sin(b*x))/b, Eq(c, pi/2)), (log(sin(b*x))/b, Eq(c, -pi/2)), (x/cos(c), Eq( b, 0)), (-b*x*tan(c/2)**2/(b*tan(c/2)**2 + b) + b*x/(b*tan(c/2)**2 + b) + 2*log(tan(b*x/2)**2 + 1)*tan(c/2)/(b*tan(c/2)**2 + b) - 2*log(tan(b*x/2) - tan(c/2)/(tan(c/2) - 1) - 1/(tan(c/2) - 1))*tan(c/2)/(b*tan(c/2)**2 + b) - 2*log(tan(b*x/2) + tan(c/2)/(tan(c/2) + 1) - 1/(tan(c/2) + 1))*tan(c/2)/ (b*tan(c/2)**2 + b), True))*cos(a)
Leaf count of result is larger than twice the leaf count of optimal. 74 vs. \(2 (26) = 52\).
Time = 0.25 (sec) , antiderivative size = 74, normalized size of antiderivative = 2.85 \[ \int \cos (a+b x) \sec (c+b x) \, dx=\frac {2 \, b x \cos \left (-a + c\right ) - \log \left (\cos \left (2 \, b x\right )^{2} + 2 \, \cos \left (2 \, b x\right ) \cos \left (2 \, c\right ) + \cos \left (2 \, c\right )^{2} + \sin \left (2 \, b x\right )^{2} - 2 \, \sin \left (2 \, b x\right ) \sin \left (2 \, c\right ) + \sin \left (2 \, c\right )^{2}\right ) \sin \left (-a + c\right )}{2 \, b} \]
1/2*(2*b*x*cos(-a + c) - log(cos(2*b*x)^2 + 2*cos(2*b*x)*cos(2*c) + cos(2* c)^2 + sin(2*b*x)^2 - 2*sin(2*b*x)*sin(2*c) + sin(2*c)^2)*sin(-a + c))/b
Leaf count of result is larger than twice the leaf count of optimal. 440 vs. \(2 (26) = 52\).
Time = 0.34 (sec) , antiderivative size = 440, normalized size of antiderivative = 16.92 \[ \int \cos (a+b x) \sec (c+b x) \, dx=\frac {\frac {{\left (\tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} - \tan \left (\frac {1}{2} \, a\right )^{2} + 4 \, \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right ) - \tan \left (\frac {1}{2} \, c\right )^{2} + 1\right )} {\left (b x + a\right )}}{\tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + \tan \left (\frac {1}{2} \, a\right )^{2} + \tan \left (\frac {1}{2} \, c\right )^{2} + 1} - \frac {{\left (\tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right ) - \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right )^{2} + \tan \left (\frac {1}{2} \, a\right ) - \tan \left (\frac {1}{2} \, c\right )\right )} \log \left (\tan \left (b x + a\right )^{2} + 1\right )}{\tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + \tan \left (\frac {1}{2} \, a\right )^{2} + \tan \left (\frac {1}{2} \, c\right )^{2} + 1} + \frac {2 \, {\left (\tan \left (\frac {1}{2} \, a\right )^{4} \tan \left (\frac {1}{2} \, c\right )^{2} - 2 \, \tan \left (\frac {1}{2} \, a\right )^{3} \tan \left (\frac {1}{2} \, c\right )^{3} + \tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, a\right )^{3} \tan \left (\frac {1}{2} \, c\right ) - 4 \, \tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + 2 \, \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right )^{3} + \tan \left (\frac {1}{2} \, a\right )^{2} - 2 \, \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right ) + \tan \left (\frac {1}{2} \, c\right )^{2}\right )} \log \left ({\left | 2 \, \tan \left (b x + a\right ) \tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right ) - 2 \, \tan \left (b x + a\right ) \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right )^{2} + \tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + 2 \, \tan \left (b x + a\right ) \tan \left (\frac {1}{2} \, a\right ) - \tan \left (\frac {1}{2} \, a\right )^{2} - 2 \, \tan \left (b x + a\right ) \tan \left (\frac {1}{2} \, c\right ) + 4 \, \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right ) - \tan \left (\frac {1}{2} \, c\right )^{2} + 1 \right |}\right )}{\tan \left (\frac {1}{2} \, a\right )^{4} \tan \left (\frac {1}{2} \, c\right )^{3} - \tan \left (\frac {1}{2} \, a\right )^{3} \tan \left (\frac {1}{2} \, c\right )^{4} + \tan \left (\frac {1}{2} \, a\right )^{4} \tan \left (\frac {1}{2} \, c\right ) - \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right )^{4} + \tan \left (\frac {1}{2} \, a\right )^{3} - \tan \left (\frac {1}{2} \, c\right )^{3} + \tan \left (\frac {1}{2} \, a\right ) - \tan \left (\frac {1}{2} \, c\right )}}{b} \]
((tan(1/2*a)^2*tan(1/2*c)^2 - tan(1/2*a)^2 + 4*tan(1/2*a)*tan(1/2*c) - tan (1/2*c)^2 + 1)*(b*x + a)/(tan(1/2*a)^2*tan(1/2*c)^2 + tan(1/2*a)^2 + tan(1 /2*c)^2 + 1) - (tan(1/2*a)^2*tan(1/2*c) - tan(1/2*a)*tan(1/2*c)^2 + tan(1/ 2*a) - tan(1/2*c))*log(tan(b*x + a)^2 + 1)/(tan(1/2*a)^2*tan(1/2*c)^2 + ta n(1/2*a)^2 + tan(1/2*c)^2 + 1) + 2*(tan(1/2*a)^4*tan(1/2*c)^2 - 2*tan(1/2* a)^3*tan(1/2*c)^3 + tan(1/2*a)^2*tan(1/2*c)^4 + 2*tan(1/2*a)^3*tan(1/2*c) - 4*tan(1/2*a)^2*tan(1/2*c)^2 + 2*tan(1/2*a)*tan(1/2*c)^3 + tan(1/2*a)^2 - 2*tan(1/2*a)*tan(1/2*c) + tan(1/2*c)^2)*log(abs(2*tan(b*x + a)*tan(1/2*a) ^2*tan(1/2*c) - 2*tan(b*x + a)*tan(1/2*a)*tan(1/2*c)^2 + tan(1/2*a)^2*tan( 1/2*c)^2 + 2*tan(b*x + a)*tan(1/2*a) - tan(1/2*a)^2 - 2*tan(b*x + a)*tan(1 /2*c) + 4*tan(1/2*a)*tan(1/2*c) - tan(1/2*c)^2 + 1))/(tan(1/2*a)^4*tan(1/2 *c)^3 - tan(1/2*a)^3*tan(1/2*c)^4 + tan(1/2*a)^4*tan(1/2*c) - tan(1/2*a)*t an(1/2*c)^4 + tan(1/2*a)^3 - tan(1/2*c)^3 + tan(1/2*a) - tan(1/2*c)))/b
Time = 22.26 (sec) , antiderivative size = 109, normalized size of antiderivative = 4.19 \[ \int \cos (a+b x) \sec (c+b x) \, dx=x\,\left (\frac {{\mathrm {e}}^{-a\,1{}\mathrm {i}+c\,1{}\mathrm {i}}}{2}-\frac {{\mathrm {e}}^{a\,1{}\mathrm {i}-c\,1{}\mathrm {i}}}{2}\right )+x\,\left (\frac {{\mathrm {e}}^{-a\,1{}\mathrm {i}+c\,1{}\mathrm {i}}}{2}+\frac {{\mathrm {e}}^{a\,1{}\mathrm {i}-c\,1{}\mathrm {i}}}{2}\right )+\frac {\ln \left ({\mathrm {e}}^{a\,2{}\mathrm {i}-c\,2{}\mathrm {i}}+{\mathrm {e}}^{a\,2{}\mathrm {i}+b\,x\,2{}\mathrm {i}}\right )\,\left (\frac {{\mathrm {e}}^{-a\,1{}\mathrm {i}+c\,1{}\mathrm {i}}\,1{}\mathrm {i}}{2}-\frac {{\mathrm {e}}^{a\,1{}\mathrm {i}-c\,1{}\mathrm {i}}\,1{}\mathrm {i}}{2}\right )}{b} \]